//去除空格
function trim(stringToTrim) 
{	return stringToTrim.replace(/^\s+|\s+$/g,"");}
function lTrim(stringToTrim) 
{	return stringToTrim.replace(/^\s+/,"");}
function rTrim(stringToTrim) 
{	return stringToTrim.replace(/\s+$/,"");}

//验证邮件
function checkEmail(value)
{   
  var   patrn=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;     
  if   (!patrn.exec(value))
  {   
  alert("Email must be like mike@simple.com");   
  return false;   
  }

  return true;
}

function browserType()
{
   if(navigator.userAgent.indexOf("MSIE")>0) return "ie";
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0) return "ff";
   if(isSafari=navigator.userAgent.indexOf("Safari")>0) return "safari";
   if(isCamino=navigator.userAgent.indexOf("Camino")>0) return "camino";
   if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0) return "gecko";
   return 0;
}

function setRadioButton(name, value)
{
    var els = document.getElementsByName(name);
    var length = els.length;
    for (var i = 0; i < length; i++) {
        if (els[i].value == value) {
            els[i].checked = true;
            break;
        }
    }
}



